<template>
    <div class="content_item">
        <div class="left">
            <img :src="item.pic" />
            <div class="text">
                <div class="title">{{ item.title }}</div>
                <van-icon v-if="item.add && showAdd" name="add-o" @click="addClick(item.id)" />
                <van-stepper @change="onChange" :name="item.id" :min="1" v-else v-model="item.num"></van-stepper>
            </div>

        </div>

    </div>
</template>

<script lang='ts' setup>
import { ref, defineProps } from 'vue'
const props = defineProps(['item', 'addClick', "showAdd",'onChange'])
</script>
<style lang="scss" scoped>
.content_item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;

    .price {
        font-size: 16px;
        font-weight: 600;
    }

    .left {
        display: flex;
        align-items: center;
        flex: 1;

        img {
            margin-left: 10px;
            width: 60px;
            height: 60px;
            margin-right: 10px;
            border-radius: 10px;
        }

        .text {
            display: flex;
            flex-flow: column;
            justify-content: space-between;
            height: 100%;
            position: relative;
            flex: 1;

            .title {
                font-size: 16px;
            }

            .van-icon {
                color: red;
                font-size: 20px;
                position: absolute;
                right: 4px;
                bottom: 4px;
            }
        }
    }
}
</style>